{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6ebca60b",
   "metadata": {},
   "source": [
    "## Kubernetes Clusterwide Kafka mTLS Demo"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ba016c14",
   "metadata": {},
   "source": [
    "### Setup\n",
    "\n",
    "Create a Kind cluster by using an ansible playbook from the project `ansible` folder.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8bc29bc5",
   "metadata": {},
   "outputs": [],
   "source": [
    "!cd ../ansible && ansible-playbook playbooks/kind-cluster.yaml"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b12607ca",
   "metadata": {},
   "outputs": [],
   "source": [
    "!cd ../ansible && ansible-playbook playbooks/setup-ecosystem.yaml"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 172,
   "id": "b4d93216",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Release \"seldon-core-v2-crds\" has been upgraded. Happy Helming!\r\n",
      "NAME: seldon-core-v2-crds\r\n",
      "LAST DEPLOYED: Thu Jun 22 15:22:04 2023\r\n",
      "NAMESPACE: seldon-mesh\r\n",
      "STATUS: deployed\r\n",
      "REVISION: 5\r\n",
      "TEST SUITE: None\r\n"
     ]
    }
   ],
   "source": [
    "!helm upgrade --install seldon-core-v2-crds  ../k8s/helm-charts/seldon-core-v2-crds -n seldon-mesh"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 173,
   "id": "bcf13333",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "namespace/ns1 created\r\n"
     ]
    }
   ],
   "source": [
    "!kubectl create namespace ns1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 174,
   "id": "edba01cd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "namespace/ns2 created\r\n"
     ]
    }
   ],
   "source": [
    "!kubectl create namespace ns2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 175,
   "id": "6a9cdb85",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "---\r\n",
      "kafka:\r\n",
      "  bootstrap: seldon-kafka-bootstrap.seldon-mesh.svc.cluster.local:9093\r\n",
      "\r\n",
      "security:\r\n",
      "  kafka:\r\n",
      "    protocol: SSL\r\n",
      "    ssl:\r\n",
      "      client:\r\n",
      "        secret: seldon\r\n",
      "        brokerValidationSecret: seldon-cluster-ca-cert\r\n",
      "        keyPath: /tmp/certs/kafka/client/user.key\r\n",
      "        crtPath: /tmp/certs/kafka/client/user.crt\r\n",
      "        caPath: /tmp/certs/kafka/client/ca.crt\r\n",
      "        brokerCaPath: /tmp/certs/kafka/broker/ca.crt\r\n"
     ]
    }
   ],
   "source": [
    "!cat ../k8s/samples/values-strimzi-kafka-mtls.yaml"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 176,
   "id": "71bf922e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NAME: seldon-v2\r\n",
      "LAST DEPLOYED: Thu Jun 22 15:22:11 2023\r\n",
      "NAMESPACE: seldon-mesh\r\n",
      "STATUS: deployed\r\n",
      "REVISION: 1\r\n",
      "TEST SUITE: None\r\n"
     ]
    }
   ],
   "source": [
    "!helm install seldon-v2 ../k8s/helm-charts/seldon-core-v2-setup/ -n seldon-mesh --set controller.clusterwide=true --values ../k8s/samples/values-strimzi-kafka-mtls.yaml"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "67ac3da4",
   "metadata": {},
   "source": [
    "## Copy Strimzi secrets to namespaces\n",
    "\n",
    "Strimzi doesn't allow a single Kafka cluster to be used in TLS easily from multiple namespaces without copying the user Secrets created by the KafkaUser to those namespaces."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 177,
   "id": "fd76efe2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "secret/seldon created\r\n"
     ]
    }
   ],
   "source": [
    "!kubectl get secret seldon -n seldon-mesh -o json | jq 'del(.metadata.ownerReferences) | del(.metadata.namespace)' | kubectl create -f - -n ns1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 178,
   "id": "b3e2dbee",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "secret/seldon-cluster-ca-cert created\r\n"
     ]
    }
   ],
   "source": [
    "!kubectl get secret seldon-cluster-ca-cert -n seldon-mesh -o json | jq 'del(.metadata.ownerReferences) | del(.metadata.namespace)' | kubectl create -f - -n ns1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 179,
   "id": "96872dd2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "secret/seldon created\r\n"
     ]
    }
   ],
   "source": [
    "!kubectl get secret seldon -n seldon-mesh -o json | jq 'del(.metadata.ownerReferences) | del(.metadata.namespace)' | kubectl create -f - -n ns2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 180,
   "id": "24ce240c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "secret/seldon-cluster-ca-cert created\r\n"
     ]
    }
   ],
   "source": [
    "!kubectl get secret seldon-cluster-ca-cert -n seldon-mesh -o json | jq 'del(.metadata.ownerReferences) | del(.metadata.namespace)' | kubectl create -f - -n ns2"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "93be7623",
   "metadata": {},
   "source": [
    "## Create SeldonRuntimes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 181,
   "id": "e28147b1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NAME: seldon-v2-runtime\r\n",
      "LAST DEPLOYED: Thu Jun 22 15:22:19 2023\r\n",
      "NAMESPACE: ns1\r\n",
      "STATUS: deployed\r\n",
      "REVISION: 1\r\n",
      "TEST SUITE: None\r\n"
     ]
    }
   ],
   "source": [
    "!helm install seldon-v2-runtime ../k8s/helm-charts/seldon-core-v2-runtime  -n ns1 --wait"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 182,
   "id": "4423b5f5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NAME: seldon-v2-runtime\r\n",
      "LAST DEPLOYED: Thu Jun 22 15:22:20 2023\r\n",
      "NAMESPACE: ns2\r\n",
      "STATUS: deployed\r\n",
      "REVISION: 1\r\n",
      "TEST SUITE: None\r\n"
     ]
    }
   ],
   "source": [
    "!helm install seldon-v2-runtime ../k8s/helm-charts/seldon-core-v2-runtime  -n ns2 --wait"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 183,
   "id": "21e2dd25",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NAME: seldon-v2-servers\r\n",
      "LAST DEPLOYED: Thu Jun 22 15:22:23 2023\r\n",
      "NAMESPACE: ns1\r\n",
      "STATUS: deployed\r\n",
      "REVISION: 1\r\n",
      "TEST SUITE: None\r\n"
     ]
    }
   ],
   "source": [
    "!helm install seldon-v2-servers ../k8s/helm-charts/seldon-core-v2-servers  -n ns1 --wait"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 184,
   "id": "56a28fc8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "NAME: seldon-v2-servers\r\n",
      "LAST DEPLOYED: Thu Jun 22 15:22:24 2023\r\n",
      "NAMESPACE: ns2\r\n",
      "STATUS: deployed\r\n",
      "REVISION: 1\r\n",
      "TEST SUITE: None\r\n"
     ]
    }
   ],
   "source": [
    "!helm install seldon-v2-servers ../k8s/helm-charts/seldon-core-v2-servers  -n ns2 --wait"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 185,
   "id": "1dd6a5dc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "server.mlops.seldon.io/mlserver condition met\n",
      "server.mlops.seldon.io/triton condition met\n"
     ]
    }
   ],
   "source": [
    "!kubectl wait --for condition=ready --timeout=300s server --all -n ns1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 186,
   "id": "e2464284",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "server.mlops.seldon.io/mlserver condition met\n",
      "server.mlops.seldon.io/triton condition met\n"
     ]
    }
   ],
   "source": [
    "!kubectl wait --for condition=ready --timeout=300s server --all -n ns2"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7d05ee2b",
   "metadata": {},
   "source": [
    "### Get Inference Endpoints"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 187,
   "id": "3835b3dc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'172.21.255.2'"
      ]
     },
     "execution_count": 187,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "MESH_IP=!kubectl get svc seldon-mesh -n ns1 -o jsonpath='{.status.loadBalancer.ingress[0].ip}'\n",
    "MESH_IP_NS1=MESH_IP[0]\n",
    "import os\n",
    "os.environ['MESH_IP_NS1'] = MESH_IP_NS1\n",
    "MESH_IP_NS1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 188,
   "id": "33f7a263",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'172.21.255.4'"
      ]
     },
     "execution_count": 188,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "MESH_IP=!kubectl get svc seldon-mesh -n ns2 -o jsonpath='{.status.loadBalancer.ingress[0].ip}'\n",
    "MESH_IP_NS2=MESH_IP[0]\n",
    "import os\n",
    "os.environ['MESH_IP_NS2'] = MESH_IP_NS2\n",
    "MESH_IP_NS2"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2243a193",
   "metadata": {},
   "source": [
    "### Launch Pipeline in Namespace ns1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 189,
   "id": "fc5fdee5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "model.mlops.seldon.io/tfsimple1 created\n",
      "model.mlops.seldon.io/tfsimple2 created\n"
     ]
    }
   ],
   "source": [
    "!kubectl create -f ./models/tfsimple1.yaml -n ns1\n",
    "!kubectl create -f ./models/tfsimple2.yaml -n ns1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 190,
   "id": "5c1328c8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "model.mlops.seldon.io/tfsimple1 condition met\n",
      "model.mlops.seldon.io/tfsimple2 condition met\n"
     ]
    }
   ],
   "source": [
    "!kubectl wait --for condition=ready --timeout=300s model --all -n ns1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 191,
   "id": "d8d6a6dd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "pipeline.mlops.seldon.io/tfsimples created\r\n"
     ]
    }
   ],
   "source": [
    "!kubectl create -f ./pipelines/tfsimples.yaml -n ns1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 192,
   "id": "f0861650",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "pipeline.mlops.seldon.io/tfsimples condition met\r\n"
     ]
    }
   ],
   "source": [
    "!kubectl wait --for condition=ready --timeout=300s pipeline --all -n ns1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 193,
   "id": "4e5f2e9c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\r\n",
      "  \"outputs\": [\r\n",
      "    {\r\n",
      "      \"name\": \"OUTPUT0\",\r\n",
      "      \"datatype\": \"INT32\",\r\n",
      "      \"shape\": [\r\n",
      "        \"1\",\r\n",
      "        \"16\"\r\n",
      "      ],\r\n",
      "      \"contents\": {\r\n",
      "        \"intContents\": [\r\n",
      "          2,\r\n",
      "          4,\r\n",
      "          6,\r\n",
      "          8,\r\n",
      "          10,\r\n",
      "          12,\r\n",
      "          14,\r\n",
      "          16,\r\n",
      "          18,\r\n",
      "          20,\r\n",
      "          22,\r\n",
      "          24,\r\n",
      "          26,\r\n",
      "          28,\r\n",
      "          30,\r\n",
      "          32\r\n",
      "        ]\r\n",
      "      }\r\n",
      "    },\r\n",
      "    {\r\n",
      "      \"name\": \"OUTPUT1\",\r\n",
      "      \"datatype\": \"INT32\",\r\n",
      "      \"shape\": [\r\n",
      "        \"1\",\r\n",
      "        \"16\"\r\n",
      "      ],\r\n",
      "      \"contents\": {\r\n",
      "        \"intContents\": [\r\n",
      "          2,\r\n",
      "          4,\r\n",
      "          6,\r\n",
      "          8,\r\n",
      "          10,\r\n",
      "          12,\r\n",
      "          14,\r\n",
      "          16,\r\n",
      "          18,\r\n",
      "          20,\r\n",
      "          22,\r\n",
      "          24,\r\n",
      "          26,\r\n",
      "          28,\r\n",
      "          30,\r\n",
      "          32\r\n",
      "        ]\r\n",
      "      }\r\n",
      "    }\r\n",
      "  ]\r\n",
      "}\r\n"
     ]
    }
   ],
   "source": [
    "!seldon pipeline infer tfsimples --inference-mode grpc --inference-host ${MESH_IP_NS1}:80 \\\n",
    "    '{\"model_name\":\"simple\",\"inputs\":[{\"name\":\"INPUT0\",\"contents\":{\"int_contents\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},\"datatype\":\"INT32\",\"shape\":[1,16]},{\"name\":\"INPUT1\",\"contents\":{\"int_contents\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},\"datatype\":\"INT32\",\"shape\":[1,16]}]}' | jq -M ."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "53ea1e35",
   "metadata": {},
   "source": [
    "### Launch Pipeline in Namespace ns2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 194,
   "id": "88954ff6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "model.mlops.seldon.io/tfsimple1 created\n",
      "model.mlops.seldon.io/tfsimple2 created\n"
     ]
    }
   ],
   "source": [
    "!kubectl create -f ./models/tfsimple1.yaml -n ns2\n",
    "!kubectl create -f ./models/tfsimple2.yaml -n ns2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 195,
   "id": "447ed372",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "model.mlops.seldon.io/tfsimple1 condition met\n",
      "model.mlops.seldon.io/tfsimple2 condition met\n"
     ]
    }
   ],
   "source": [
    "!kubectl wait --for condition=ready --timeout=300s model --all -n ns2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 196,
   "id": "95d62d6a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "pipeline.mlops.seldon.io/tfsimples created\r\n"
     ]
    }
   ],
   "source": [
    "!kubectl create -f ./pipelines/tfsimples.yaml -n ns2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 197,
   "id": "8e8ebee6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "pipeline.mlops.seldon.io/tfsimples condition met\r\n"
     ]
    }
   ],
   "source": [
    "!kubectl wait --for condition=ready --timeout=300s pipeline --all -n ns2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 199,
   "id": "1ce5d740",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\r\n",
      "  \"outputs\": [\r\n",
      "    {\r\n",
      "      \"name\": \"OUTPUT0\",\r\n",
      "      \"datatype\": \"INT32\",\r\n",
      "      \"shape\": [\r\n",
      "        \"1\",\r\n",
      "        \"16\"\r\n",
      "      ],\r\n",
      "      \"contents\": {\r\n",
      "        \"intContents\": [\r\n",
      "          2,\r\n",
      "          4,\r\n",
      "          6,\r\n",
      "          8,\r\n",
      "          10,\r\n",
      "          12,\r\n",
      "          14,\r\n",
      "          16,\r\n",
      "          18,\r\n",
      "          20,\r\n",
      "          22,\r\n",
      "          24,\r\n",
      "          26,\r\n",
      "          28,\r\n",
      "          30,\r\n",
      "          32\r\n",
      "        ]\r\n",
      "      }\r\n",
      "    },\r\n",
      "    {\r\n",
      "      \"name\": \"OUTPUT1\",\r\n",
      "      \"datatype\": \"INT32\",\r\n",
      "      \"shape\": [\r\n",
      "        \"1\",\r\n",
      "        \"16\"\r\n",
      "      ],\r\n",
      "      \"contents\": {\r\n",
      "        \"intContents\": [\r\n",
      "          2,\r\n",
      "          4,\r\n",
      "          6,\r\n",
      "          8,\r\n",
      "          10,\r\n",
      "          12,\r\n",
      "          14,\r\n",
      "          16,\r\n",
      "          18,\r\n",
      "          20,\r\n",
      "          22,\r\n",
      "          24,\r\n",
      "          26,\r\n",
      "          28,\r\n",
      "          30,\r\n",
      "          32\r\n",
      "        ]\r\n",
      "      }\r\n",
      "    }\r\n",
      "  ]\r\n",
      "}\r\n"
     ]
    }
   ],
   "source": [
    "!seldon pipeline infer tfsimples --inference-mode grpc --inference-host ${MESH_IP_NS2}:80 \\\n",
    "    '{\"model_name\":\"simple\",\"inputs\":[{\"name\":\"INPUT0\",\"contents\":{\"int_contents\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},\"datatype\":\"INT32\",\"shape\":[1,16]},{\"name\":\"INPUT1\",\"contents\":{\"int_contents\":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]},\"datatype\":\"INT32\",\"shape\":[1,16]}]}' | jq -M ."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2177c110",
   "metadata": {},
   "source": [
    "## TearDown"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 200,
   "id": "11d99aac",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "pipeline.mlops.seldon.io \"tfsimples\" deleted\n",
      "pipeline.mlops.seldon.io \"tfsimples\" deleted\n",
      "model.mlops.seldon.io \"tfsimple1\" deleted\n",
      "model.mlops.seldon.io \"tfsimple2\" deleted\n",
      "model.mlops.seldon.io \"tfsimple1\" deleted\n",
      "model.mlops.seldon.io \"tfsimple2\" deleted\n"
     ]
    }
   ],
   "source": [
    "!kubectl delete -f ./pipelines/tfsimples.yaml -n ns1\n",
    "!kubectl delete -f ./pipelines/tfsimples.yaml -n ns2\n",
    "!kubectl delete -f ./models/tfsimple1.yaml -n ns1\n",
    "!kubectl delete -f ./models/tfsimple2.yaml -n ns1\n",
    "!kubectl delete -f ./models/tfsimple1.yaml -n ns2\n",
    "!kubectl delete -f ./models/tfsimple2.yaml -n ns2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 201,
   "id": "7ab5b2e3",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "release \"seldon-v2-servers\" uninstalled\r\n"
     ]
    }
   ],
   "source": [
    "!helm delete seldon-v2-servers -n ns1 --wait"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 202,
   "id": "3a84da13",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "release \"seldon-v2-runtime\" uninstalled\r\n"
     ]
    }
   ],
   "source": [
    "!helm delete seldon-v2-runtime -n ns1 --wait"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 203,
   "id": "d77a5ae9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "release \"seldon-v2-servers\" uninstalled\r\n"
     ]
    }
   ],
   "source": [
    "!helm delete seldon-v2-servers -n ns2 --wait"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 204,
   "id": "a5e6e07c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "release \"seldon-v2-runtime\" uninstalled\r\n"
     ]
    }
   ],
   "source": [
    "!helm delete seldon-v2-runtime -n ns2 --wait"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 205,
   "id": "4b13fb4a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "release \"seldon-v2\" uninstalled\r\n"
     ]
    }
   ],
   "source": [
    "!helm delete seldon-v2  -n seldon-mesh"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 206,
   "id": "f06f0dac",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "namespace \"ns1\" deleted\n",
      "namespace \"ns2\" deleted\n"
     ]
    }
   ],
   "source": [
    "!kubectl delete namespace ns1\n",
    "!kubectl delete namespace ns2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "555788e7",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
